package com.base.obj;

import com.base.entity.Person;

import java.util.HashMap;
import java.util.Map;

/**
 * create by yongli on 2021-06-01 15:48
 * java对象的一些基本的属性，比如==，厘清这些基础的问题。
 * Instant，
 *
 */

public class Se88 {
    public static void main(String[] args) {
        Person person =new Person();
        Person person1 =new Person();
        // hashcode是一个整数值和地址相关
        // 那么当对象移动后，其hash值会发生变化吗？
        // hashmap扩容就会发生rehash
        int code = person.hashCode();

        Map<Integer,Person> map = new HashMap<>(6);
        map.put(1,person);

        for(int i=0;i<10000;i++){
            map.put(i+2,new Person());
        }
        System.out.println(map.size());
        int code1 = map.get(1).hashCode();
        System.out.println(code);
        System.out.println(code1);

        System.out.println("aaaaaaaaaaaaaaaaaaaqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq".hashCode());
        System.out.println("aaaaaaaaaaaaaaaaaaaqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq".hashCode());
        System.out.println("bb".hashCode());

    }
}
